package com.maybach.workflow.common.api.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by well on 15/6/12.
 */
public enum FlowStateEnum {

    init("进行中",0),
    end("已结束",1),
    pause("已暂停",3),
    cancle("已撤销",4),
    reject("被驳回",5),
    close("已关闭", 10),
    ;



    private String desc;

    private int status;

    FlowStateEnum(String desc, int status){
        this.desc = desc;
        this.status = status;
    }

    public String getDesc() {
        return desc;
    }

    public int getStatus() {
        return status;
    }

    public static FlowStateEnum getFlowState(int status){
        for(FlowStateEnum flowStateEnum : FlowStateEnum.values()){
            if(flowStateEnum.getStatus() == status){
                return flowStateEnum;
            }
        }
        return null;
    }


    public static List<Integer> getAllState(){
        List<Integer> status = new ArrayList<Integer>();
        status.add(0);
        status.add(1);
        status.add(3);
        status.add(4);
        status.add(5);
        status.add(10);

        return status;
    }

    //获取未完结状态
    public static List<Integer> getNotOverState(){
        List<Integer> status = new ArrayList<Integer>();

        for(int i : FlowStateEnum.getAllState()){
            if(i!=FlowStateEnum.end.getStatus()&&i!=FlowStateEnum.close.getStatus()){
                status.add(i);
            }
        }
        return status;
    }
}
